﻿
namespace SearchForWorkitemsChanges
{
    /// <summary>
    /// Generic class for transforming a type on a selectabletype (GUI)
    /// </summary>
    /// <typeparam name="T">Type to make selectable in a graphical control.</typeparam>
    internal class SelectableItem<T> : VmBase<SelectableItem<T>>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SelectableItem{T}" /> class.
        /// </summary>
        /// <param name="item">The {T} item.</param>
        public SelectableItem(T item)
        {
            this.Item = item;
        }

        private bool isSelected;

        /// <summary>
        /// Gets or sets a value indicating whether this instance is selected.
        /// Raise the PropertyChangedEvent on value changing
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance is selected; otherwise, <c>false</c>.
        /// </value>
        public bool IsSelected
        {
            get { return this.isSelected; }
            set { this.isSelected = value; this.NotifyPropertyChanged(p => p.IsSelected); }
        }

        /// <summary>
        /// Gets or sets the item.
        /// </summary>
        /// <value>
        /// The item.
        /// </value>
        public T Item { get; set; }
    }
}
